<?php
  class Plugins_Pricefull extends model {
  
  
  
  function getformadd($productid="")
  {
  
  
$code  = '<form class="wrpCmrcPlg">'."\n";
$code .= '<fieldset class="CmrcPlg">'."\n";
$code .= '<div class="cmrcPlg fs04 clTxt2">'."\n";
$code .= '<div class="hdCmrcPlg">'."\n";
$code .= '<span class="boldGen">Commerce</span>'."\n";
$code .= '</div>'."\n";
$code .= '<div class="bdCmrcPlg">'."\n";
$code .= '<div class="wrpRdoCmrcPlg">'."\n";
$code .= '<div class="rdoCmrcPlg clearfix">'."\n";
$code .= '<span class="boldGen">Add to Cart Button</span>'."\n";
$code .= '<div class="rdoAttCmrcPlg">'."\n";
$code .= '<input type="radio" checked="" value="1" name="cart[]">'."\n";
$code .= '<label>Show</label>'."\n";
$code .= '<input type="radio" value="2"  name="cart[]">'."\n";
$code .= '<label>Hide</label>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '<div class="rdoCmrcPlg clearfix">'."\n";
$code .= '<span class="boldGen">Product Attribute</span>'."\n";
$code .= '<div class="rdoAttCmrcPlg">'."\n";
$code .= '<input type="radio" value="1" checked="" name="attr[]">'."\n";
$code .= '<label>Unavailable</label>'."\n";
$code .= '<input type="radio" value="2" name="attr[]">'."\n";
$code .= '<label>Available</label>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '<div class="wrpInpCmrcPlg noAttPdPlg clBg3 clBd2 bdFull">'."\n";
$code .= '<div class="inpCmrcPlg newPrcPlg">'."\n";
$code .= '<div class="hdNewPlg">'."\n";
$code .= '<span class="boldGen">Price</span>'."\n";
$code .= '</div>'."\n";
$code .= '<div class="bdNewPlg">'."\n";
$code .= '<div class="prcNewPrcPlg">'."\n";
$code .= '<span>Price</span>'."\n";
$code .= '<input type="text" name="price[]" class="inpAddCtnt w120 clBg5 clBd2 fs03 clTxt2">'."\n";
$code .= '<span>Baht</span>'."\n";
$code .= '</div>'."\n";
$code .= '<div class="saleNewPrcPlg">'."\n";
$code .= '<div class="hdSaleNewPrc">'."\n";
$code .= '<input type="checkbox" name="userpoint[]" value="1">'."\n";
$code .= '<label>Use Pay with Points</label>'."\n";
$code .= '</div>'."\n";
$code .= '<div class="bdSaleNewPrc">'."\n";
$code .= '<div class="prcNewPrcPlg">'."\n";
$code .= '<span>This item = </span>'."\n";
$code .= '<input type="text" name="point[]" class="inpAddCtnt w120 clBg5 clBd2 fs03 clTxt2">'."\n";
$code .= '<span>Point(s)</span>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '<div class="saleNewPrcPlg">'."\n";
$code .= '<div class="hdSaleNewPrc">'."\n";
$code .= '<input type="checkbox" name="usersale[]" value="1">'."\n";
$code .= '<label>Use Sale Price</label>'."\n";
$code .= '</div>'."\n";
$code .= '<div class="bdSaleNewPrc">'."\n";
$code .= '<div class="wrpDecNewPrc reduceNewPrc clearfix">'."\n";
$code .= '<div class="decNewPrc">'."\n";
$code .= '<input type="radio" name="statusesale[]" value="1">'."\n";
$code .= '<label>ลดเหลือ</label>'."\n";
$code .= '<input type="text" name="saleprice[]" class="inpAddCtnt w120 clBg5 clBd2 fs03 clTxt2">'."\n";
$code .= '<span>Baht</span>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '<div class="wrpDecNewPrc lowerNewPrc clearfix">'."\n";
$code .= '<div class="decNewPrc">'."\n";
$code .= '<input type="radio" name="statusesale[]" value="2">'."\n";
$code .= '<label>ลดลง</label>'."\n";
$code .= '<input type="text" name="salediscount[]" class="inpAddCtnt w120 clBg5 clBd2 fs03 clTxt2">'."\n";
$code .= '</div>'."\n";
$code .= '<div class="reDesign reDsNewPrc">'."\n";
$code .= '<select name="statusdiscount[]">'."\n";
$code .= '<option value="1">Baht</option>'."\n";
$code .= '<option value="2">%</option>'."\n";
$code .= '</select>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '<div class="inpCmrcPlg stckPdPlg">'."\n";
$code .= '<div class="hdNewPlg">'."\n";
$code .= '<span class="boldGen">Inventory</span>'."\n";
$code .= '<input type="checkbox" value="1" name="unlimit[]">'."\n";
$code .= '<label>Unlimited Inventory</label>'."\n";
$code .= '</div>'."\n";
$code .= '<div class="bdNewPlg">'."\n";
$code .= '<div class="blnc clearfix">'."\n";
$code .= '<span class="fs06">Current Amount : <em class="boldGen inventtext">0</em></span>'."\n";
$code .= '<a class="btnViewInvHtr fs02">Inventory Transaction</a>'."\n";
$code .= '</div>'."\n";
$code .= '<div class="wrpUpdStock">'."\n";
$code .= '<div class="updStock incStock clearfix">'."\n";
$code .= '<div class="inpUpdStck">'."\n";
$code .= '<span>Add Stock</span>'."\n";
$code .= '<input type="text" name="addstock[]" class="clBg5 clBd2 fs03 clTxt2">'."\n";
$code .= '</div>'."\n";
$code .= '<button name="btnadd" type="button" class="clTxtW clBgBt1 fs04">Update</button>'."\n";
$code .= '</div>'."\n";
$code .= '<div class="updStock expStock clearfix">'."\n";
$code .= '<div class="inpUpdStck">'."\n";
$code .= '<span>Remove Stock</span>'."\n";
$code .= '<input type="text" name="removestock[]" class="clBg5 clBd2 fs03 clTxt2">'."\n";
$code .= '</div>'."\n";
$code .= '<button name="btnremove" type="button" class="clTxtW clBgBt1 fs04">Update</button>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</fieldset>'."\n";
$code .= '</form>';
   
  $arraydata['form']=addslashes(str_replace(array("\r", "", "\r"), '', $code));
  //$arraydata['js']=pluginjsinfo.'/price.js';

  
  
      
  
  
  
  return $arraydata;
  
  
  
  
  
  
  
  }
  
  function getformlanding($arraydata)
  {
  
$code  = '<div class="ldIt wrpOutNewPrcLd clBg4">'."\n";
$code .= '<div class="wrpInNewPrcLd">'."\n";
$code .= '<div class="hdNewPrcLd clTxt2 fs04">'."\n";
$code .= '<span class="boldGen">Order</span>'."\n";
$code .= '</div>'."\n";
$code .= '<div class="bdNewPrcLd">'."\n";
$code .= '<div class="newPrc wrpNewPrcLd clearfix">'."\n";
$code .= '<h2 class="clTxt2 fs04">Regular Price</h2>'."\n";
if($arraydata['realprice']==$arraydata['price'])
{
$code .= '<span class="newPrcLd">'.$arraydata['price'].' THB</span>'."\n";
}else
{
$code .= '<span class="newPrcLd mdl">'.$arraydata['price'].' THB</span>'."\n";

}
$code .= '</div>'."\n";

if($arraydata['realprice']!=$arraydata['price'])
{
$code .= '<div class="newPrc wrpSalePrc clearfix">'."\n";
$code .= '<h2 class="clTxt2 fs04">Sale Price</h2>'."\n";
$code .= '<span class="newPrcLd">'.$arraydata['realprice'].' THB</span>'."\n";
$code .= '</div>'."\n";
}

if($arraydata['cart']=='1')
{

$code .= '<div class="newPrc wrpQtyPrc clearfix">'."\n";
$code .= '<h2 class="clTxt2 fs04">Quantity</h2>'."\n";
$code .= '<input type="text" name="qty" value="1" class="clBg5 clBd2 fs03 clTxt2">'."\n";


$code .= '<button type="button" onclick="add2cart('.$arraydata['productid'].')" class="btnAddToCart clTxtW clBgBt1 fs04">Add to Cart</button>'."\n";


if($arraydata['amount']=='0'&&$arraydata['unlimit']=='0')
{
$code .= '<span class="notEnouLd clErrTxt">Product is not enough.</span>'."\n";
}
//$code .= '<span class="notEnouLd clErrTxt">Product is not enough.</span>'."\n";

$code .= '</div>'."\n";
}
$code .= '<div class="newPrc wrpQtyPrc clearfix">'."\n";

if($arraydata['amount']=='0'&&$arraydata['unlimit']=='0')
{
$code .= '<h2 class="fs04 boldGen clErrTxt">Out of Stock</h2>'."\n";
}

$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</div>'."\n";
$code .= '</div>';

        $data['str']=$code;
        $data['target']='firsttarget';
  
  return $data;
  
  
  }
  
  function getplugin($plugreid)
  {
  
     $sql="select * from tb_plugins_pricefull where plugreid=".$plugreid;
     $arrayplugin=$this->db->db_set_1recordrow($sql);
     
     
     
     
     if($arrayplugin['realprice']!='0.00')
     {
     $arrayplugin['show']=$arrayplugin['realprice'].' '.$arrayplugin['currencyname'];
     }else if($arrayplugin['price'])
     {
     $arrayplugin['show']=$arrayplugin['realprice'].' '.$arrayplugin['currencyname'];
     }else
     {
     $arrayplugin['show']="";
     
     }
     
    
     
  
     return $arrayplugin;
  

  
  
  

  
  }
  
  function saveplugin($arraydata,$productid,$plugreid)
  {
  
  $arraydata['productid']=$productid;
  $arraydata['plugreid']=$plugreid;
  $this->db->db_set($arraydata,'tb_plugins_pricefull');
  
  
  }
  
  
  }
?>
